package top.xiaoyu.plugin;

import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;
import top.ruojy.wxbot.ChatBotPlugin;
import top.ruojy.wxbot.entity.MessageRequest;
import top.ruojy.wxbot.entity.dto.WxPpMsgDTO;
import top.ruojy.wxbot.entity.vo.request.WxPpWcfSendTextMsgReq;
import top.ruojy.wxbot.enums.MessageTypeEnum;

@Log4j2
@Component
public class HelloPlugin implements ChatBotPlugin {
    @Override
    public String getDeveloperName() {
        return "小Y";
    }

    @Override
    public String getPluginVersion() {
        return "V1.0.0";
    }

    @Override
    public String getPluginDescription() {
        return "开启群聊艾特你回复 hello world";
    }

    @Override
    public void initialize() {
        System.out.println("hello plugin init!!!");
    }

    @Override
    public void destroy() {
        System.out.println("hello plugin destroy!!!");
    }

    @Override
    public MessageRequest handleGroupAtMeMessage(WxPpMsgDTO wxPpMsgDTO) {
        WxPpWcfSendTextMsgReq wxPpWcfSendTextMsgReq = new WxPpWcfSendTextMsgReq();
        wxPpWcfSendTextMsgReq.setMsgText("hello world");
        wxPpWcfSendTextMsgReq.setRecipient(wxPpMsgDTO.getRoomId());
        wxPpWcfSendTextMsgReq.setIsAtAll(false);
        return MessageRequest.create(MessageTypeEnum.TEXT, wxPpWcfSendTextMsgReq);
    }
}
